<?php
class Dig_Paginator_Adapter_Model extends Zend_Paginator_Adapter_DbSelect
{
    protected $_model;
    
    public function __construct($model)
    {
        if(!$model instanceof Dig_Model_Abstract ) {
            $this->_model = new $model();
        } else {
            $this->_model = $model;
        }
        parent::__construct($this->_model->select());
    }
    /**
     * Returns an array of Dig Models 
     *
     * @param  integer $offset Page offset
     * @param  integer $itemCountPerPage Number of items per page
     * @return array
     */
    public function getItems($offset, $itemCountPerPage)
    {
        $this->_select->limit($itemCountPerPage, $offset);
        
        return $this->_model->fetchAll($this->_select);
    }
}
?>